#include "CaseUIFactory.hpp"
#include "CaseConnectionConfigFactory.hpp"
#include "PathUtils.hpp"
#include "AbsUI/MainWindow.hpp"
#include "Storage/ConnectionConfigCollection.hpp"
#include "Storage/ConfigurationCenter.hpp"
#include "QtUI/QtUIConfigurationCenter.hpp"
#include <QtGui/QApplication>
#include <fstream>

int main( int argc, char** argv)
{
	QApplication app( argc, argv);

	// Setup application
	//		Connections
	CaseConnectionConfigFactory connCfgFactory;
	Storage::ConnectionConfigCollection connCfgs( connCfgFactory);
	CaseUIFactory uiFactory;

	//		Create the settings object and set it globally.
	QtUI::QtUIConfigurationCenter cfgCenter( connCfgs, getConfigurationPath(), uiFactory);
	Storage::ConfigurationCenter::setConfigCenter( &cfgCenter);
	//		Loading connections
	cfgCenter.connCfgCollection().load( cfgCenter.connectionsFilePath());

	std::auto_ptr< AbsUI::MainWindow> pMainWindow( uiFactory.createMainWindow());

	pMainWindow->show();

	return app.exec();
}
